package com.peaksport.framework.extend.jpa;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.TemporalType;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.NoRepositoryBean;

import com.peaksport.framework.metadata.view.EntityViewInfo;

@NoRepositoryBean
public interface PKJpaRepository<T, ID extends Serializable> extends JpaRepository<T, ID> {
	
	/** 实体entityType缓存key*/
	public static final String cache_key_forever_entityType = "cache_key_forever_entityType";

	/*public CoreBaseEntity addnew(CoreBaseEntity coreBaseEntity);
	public CoreBaseEntity update(CoreBaseEntity coreBaseEntity);
	public CoreBaseEntity getValue(String pk);
	public CoreBaseEntity getValue(String pk, SelectorItemCollection sic);
	public CoreBaseEntity getValue(String pk, EntityViewInfo entityViewInfo);
	public boolean delete(String pk);
	public boolean isExists(String pk);*/
	
	public EntityManager getEntityManager();
	
	public Object queryOneValueForNative(String sql);
	public Object queryOneRecordForNative(String sql, Class<?> resultClass);
	public Object queryOneRecordForNative(String sql, Class<?> resultClass, boolean isMapTransfer);
	public List<?> queryRecordForNative(String sql, Class<?> resultClass);
	public List<?> queryRecordForNative(String sql, Class<?> resultClass, boolean isMapTransfer);
	public boolean isExistsForNative(String sql);
	public boolean delete(String pk);
	public int executeSqlForNative(String sql,String[] paramNames,Object[] paramValues,HashMap<String, TemporalType> dateTemporalType);
	public int executeSqlForNative(String sql);
	public int[] batchExecuteSqlForNative(String... sqls);
	public Date getCurrentTime();
	
	public <S extends T> S getValue(EntityViewInfo entityViewInfo, Class<T> entityClass);
	

}
